1. Field of the Invention
The present invention relates to a data processing device which communicates with an external device, a communication processing method which is adopted by the relevant data processing device, and a computer program which is used to cause the relevant data processing device to execute the relevant communication processing method.
2. Related Background Art
Conventionally, a communication method in which flow control is executed by using a window size is known (for example, Japanese Patent Application Laid-Open Nos. H11-261619 and 2004-064665).
More specifically, a data processing device on the data reception side secures the reception buffer corresponding to the window size, temporarily stores the data transferred from the data transfer (or transmission) side, and holds the stored data until a read request is issued based on an application program.
Then, if the data process based on the application program delays and thus the reception buffer is filled with the stored data before the read request is issued, the data processing device on the data reception side notifies the transfer side that the window size is “0”. Thus, the data transfer from the data transfer side is suppressed.
Incidentally, even if an acknowledgement (or confirmatory response) packet (hereinafter simply called an acknowledgment) is not transferred from the data processing device on the data reception side, the transfer side can transfer the data of the size indicated by the window size. For this reason, the number of acknowledgments can be made less by just that much, whereby it is possible to increase communication efficiency as much as the window size is made larger.
However, for example, in some communication methods of connection type in which TCP (Transmission Control Protocol) is used, after the connection between the transfer side and the data processing device on the reception side was established, the transfer side immediately starts transferring print data and then normally ends the operation as soon as it ends the transmission of the print data.
For example, as shown in FIG. 6, in a case where the window size is eight kilobytes (KB) and the data size of the print data to be transferred is five kilobytes, if the transfer side transfers a connection establishment request packet (hereinafter called a connection establishment request) and the data processing device on the reception side transfers a connection establishment acknowledgment packet (hereinafter called a connection establishment acknowledgment) to establish the connection between the transfer side and the data processing device on the reception side, then the transfer side immediately ends the data transfer. This is because the window size included in the connection establishment acknowledgment is larger than the data size of the print data to be transferred, and thus the data of five kilobytes is completely held in the reception buffer. Thus, as soon as the transfer side ends the transfer the print data and transfers a disconnection request packet (hereinafter called a disconnection request) indicating the end of the connection, it judges that the transfer of the print data normally ends.
Meanwhile, in a case where the data processing device on the reception side confirms, according to the establishment of the connection, whether or not an error occurs, it sometimes confirms that the error by which it is necessary to refuse printing of the transferred print data occurs. In such a case, the data processing device disconnects the established connection and discards the data held in the reception buffer. Therefore, in a case where the transfer side can detect that the established connection is disconnected by the data processing device on the way to transferring the data, the transfer side can judge that it fails to transfer the print data.
However, as shown in FIG. 6, in the case where the data of which the size is smaller than the window size is transferred, the transfer side immediately ends the data transfer. For this reason, there is a fear that the transfer side judges that the transfer of the print data normally ends before it confirms that the error occurs on the side of the data processing device. In such a case, there is a possibility that, although a user believes that the print data has been transferred without accident, the printing based on the print data is not actually executed. In addition, there is a possibility that the transferred data itself has been discarded by the data processing device on the reception side.
To cope with such inconvenience, if the window sizes are uniformly reduced, the transfer side can instantly detect that an error occurs in the data processing device on the reception side. However, in that case, if the data transfer is continuously executed by using the small window size, the number of times of transferring acknowledgments remarkably increases, whereby communication efficiency seriously degrades.